package cn.xzchain.concurrency.publish;

import cn.xzchain.concurrency.annoations.NotThreadSafe;
import lombok.extern.slf4j.Slf4j;

/**
 * @author lihang
 * @date 2018/5/7.
 * @description 在对象初始化未完成时候就被使用将是危险的
 */
@Slf4j
@NotThreadSafe
public class Escape {

    private int thisCanBeEscape = 0;

    public Escape(){
        new InnerClass();
        thisCanBeEscape = 1;
    }

    private class InnerClass {
        public InnerClass(){
            log.info("{}",Escape.this.thisCanBeEscape);
        }
    }

    public static void main(String[] args) {
        new Escape();
    }
}
